<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:range="http://www.w3.org/1999/xhtml"
      th:replace="layouts/master(title='学生列表')">   <!--layout文件路径-->

<th:block th:fragment="css">
    <!--如果没有内容，请保持-->
    <link rel="stylesheet" href="/plugins/bootstraptable/bootstrap-table.min.css">
    <style>
        /* 自定义错误提示文字样式 */
        label.error {
            color: red; /* 设置颜色为红色 */
            font-size: 14px; /* 设置字体大小 */
            margin-top: 5px; /* 设置上边距 */
        }
    </style>
</th:block>

<div th:fragment="content">
    <div class="container-fluid">
        <h1 style="text-align:center;margin: 20px auto" >学生信息表</h1>
        <div class="model-header" style="margin: 20px auto">
            <!-- Button trigger modal -->
            <button id="addButton" type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal" onclick="preAdd();">
                新增学生
            </button>
            <!-- 查询表单 -->
            <div class="form-inline" style="margin-left: 350px">
                <input type="text" id="queryNo" class="form-control" placeholder="学号">
                <input type="text" id="queryName" class="form-control" placeholder="姓名">
                <select id="querySex" class="form-control">
                    <option value="">性别</option>
                    <option value="1">男</option>
                    <option value="2">女</option>
                </select>
                <select id="queryAgeRange" class="form-control">
                    <option value="">年龄段</option>
                    <option value="0-18">0-18</option>
                    <option value="19-30">19-30</option>
                    <option value="31-45">31-45</option>
                    <!-- 其他年龄段选项 -->
                </select>
                <select id="queryScoreRange" class="form-control">
                    <option value="">分数段</option>
                    <option value="0-59">0-59</option>
                    <option value="60-69">60-69</option>
                    <option value="70-79">70-79</option>
                    <option value="80-89">80-89</option>
                    <option value="90-99">90-99</option>
                    <option value="100-100">100</option>
                </select>
                <button class="btn btn-default" onclick="searchStudents()">查询</button>
            </div>
        </div>
        <!--表格-->
        <table class="table table-striped" id="students" ></table>

    </div>
    <!--模态框-->
    <div class="modal fade" tabindex="-1" role="dialog" id="myModal">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title">新增学生信息</h4>
                </div>
                <form id="formStudent" >
                    <div class="modal-body">
                        <input hidden="hidden" id="id" name="id" />
                        <div class="form-group">
                            <label for="no">学号</label>
                            <input type="text" class="form-control" id="no" name="no" placeholder="请输入学号" required minlength="10" maxlength="10">
                        </div>
                        <div class="form-group">
                            <label for="name" >姓名</label>
                            <input type="text" class="form-control" id="name" name="name" placeholder="请输入姓名" required minlength="2" maxlength="20">
                        </div>
                        <div class="form-group">
                            <label for="password">密码</label>
                            <input type="password" class="form-control" id="password" name="password" placeholder="请输入密码" minlength="6" maxlength="6">
                        </div>
                        <div class="form-group">
                            <label for="sex">性别</label>
                            <select class="form-control" id="sex" name="sex" required>
                                <option value="1">男</option>
                                <option value="2">女</option>
                            </select>
                        </div>
                        <div class="form-group">
                            <label for="age">年龄</label>
                            <input type="text" class="form-control" id="age" name="age" placeholder="请输入年龄" required min="15" max="45">
                        </div>
                        <div class="form-group">
                            <label for="score">分数</label>
                            <input type="text" class="form-control" id="score" name="score" placeholder="请输入成绩" required range:[0,100]>
                        </div>
                    </div>
                    <div class="modal-footer">
                       <!-- 模态框触发按钮 -->
                        <button type="submit" class="btn btn-primary" id="submitButton" >提交更改</button>
                    </div>
                </form>
                <!-- 表单结束-->

            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->
<div th:fragment="scripts">
        <!--如果没有内容，请保持-->
        <script src="/plugins/bootstraptable/bootstrap-table.min.js"></script>
        <script src="/plugins/bootstraptable/locale/bootstrap-table-zh-CN.min.js"></script>
        <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"></script>
        <!--        表单验证-->
        <script src="/plugins/jqvalidate/jquery.validate.min.js"></script>
        <script src="/plugins/jqvalidate/localization/messages_zh.min.js"></script>
        <script type="text/javascript" src="/pagejs/student/list3.js"></script>
</div>

</html>


